import Vue from 'vue';

const pemissions = sessionStorage.getItem('permissions') ? JSON.parse(sessionStorage.getItem('permissions')) : null;

Vue.directive('permission', {
	bind(el, bingding, vnode) {
		const v = bingding.value;
		const b = pemissions.find((e) => e.code == v);

		if (!b) {
			vnode.context.$nextTick(() => el.parentNode.removeChild(el));
		}
	}
});
